﻿using Sw.Hospital.HealthExaminationSystem.Application.Company;
using Sw.Hospital.HealthExaminationSystem.Application.CusReg.Dto;
using Sw.Hospital.HealthExaminationSystem.Common.Bases;
using Sw.Hospital.HealthExaminationSystem.Common.Helpers;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Sw.Hospital.HealthExaminationSystem.Statistics.AddStatistics
{
    public partial class frmShort : UserBaseForm
    {
        public frmShort()
        {
            InitializeComponent();
        }

        private void frmShort_Load(object sender, EventArgs e)
        {

        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            IClientRegAppService _clientRegAppService = new ClientRegAppService(); // 预约仓储

            SearchDto Search = new SearchDto();
            if (!string.IsNullOrEmpty(dateEdit1.EditValue?.ToString()))
            {
                Search.Star =DateTime.Parse( dateEdit1.DateTime.ToShortDateString());
            }
            if (!string.IsNullOrEmpty(dateEdit2.EditValue?.ToString()))
            {
                Search.End = DateTime.Parse(dateEdit2.DateTime.ToShortDateString() + " 23:00:00");
            }
            if (!string.IsNullOrEmpty(textBox1.Text))
            {
                Search.cusRegBM = textBox1.Text;
            }
            if (!string.IsNullOrEmpty(textEdit1.EditValue?.ToString()))
            {
                Search.Name = textEdit1.EditValue.ToString();
            }
          var shortMe=  _clientRegAppService.GetMessage(Search);
            gridControl1.DataSource = shortMe;
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {
            try
            {
                ExcelHelper.GridViewToExcel(gridView1, "短信记录", "短信记录");

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }
        }
    }
}
